package main.ui;

import main.Game.Command;
import main.Game.SendInfor;

/**
 * 游戏执行时类
 * @author svitter
 *
 */
public class FrontInfor extends Menu {

	/**
	 * 执行攻击命令
	 * @return 攻击信息
	 */
	public SendInfor attack() {
		System.out.println("Attack --------------");
		System.out.println("输入要攻击的对象(uid):");
		si.objid = in.nextInt();
		System.out.println("输入要猜的排的位置：");
		si.num = in.nextInt();
		System.out.println("输入猜测的值:");
		si.val = in.nextInt();

		return si;
	}

	/**
	 * 猜测情况
	 * @param 猜测是否成功
	 */
	public void attackSuccess(boolean successOrnot) {
		// TODO Auto-generated method stub
		if (successOrnot)
			cout("Attack success!");
		else
			cout("Attack failure!");
	}

	/**
	 * 结束回合
	 * 
	 * @param si
	 */
	public void exitTurn(SendInfor si) {
		cout(si.name + "turn compelete.");
	}

	/**
	 * 显示pass...
	 */
	public void pass() {
		cout("pass...");
	}

	/**
	 * 输入命令
	 * 
	 * @param turn
	 * @return
	 */
	public SendInfor chooseCommand(Command turn) {
		// TODO Auto-generated method stub
		if (turn == Command.TURN) {
			System.out.println("输入您的命令：");
			String str;
			str = in.next();
			switch (str) {
			case "attack":
				si.cmd = Command.ATTACK;
				break;
			case "help":
				si.cmd = Command.HELP;
				break;
			case "pass":
				si.cmd = Command.PASS;
				break;
			case "show":
				si.cmd = Command.SHOW;
				break;
			default:
				System.out.println("Error Input. Not handle.");
				//
				break;
			}
		} else if (turn == Command.WAIT) {
			System.out.println("Waiting...");
		} else if (turn == Command.LOSE) {

		} else {

		}
		return null;
	}

	/**
	 * 轮到谁的回合
	 * 
	 * @param 轮到谁
	 * @param 询问者 
	 */
	public void whosTurn(int turn, int yourTurn) {
		if (turn == yourTurn)
			System.out.println("Your turn !!");
		else
			System.out.println("Waiting...");
	}

	/**
	 * 谁先进行游戏
	 * 
	 * @return 游戏编号
	 */
	public int whosFirst() {
		cout("who's the first?");
		int temp = in.nextInt();
		return temp;
	}

	/**
	 * 确定
	 * 
	 * @return
	 */
	public boolean confirm() {
		cout("yes/no?(y/n)");
		String temp;
		temp = in.next();
		if (temp.equals("y")) {
			return true;
		} else {
			return false;
		}
	}
}
